( function ( D ) {

    D.animate = function ( frameRate ) 
    {
        var interval;

        var runner = function( ) 
        {
          for( var i in D.elements ) 
          {
            D.elements[ i ].update( );
          }

          if( D.todo.length > 0 ) 
          {
            D.get( D.todo.pop( ) );
          }
        };

        document.getElementById( "holder" ).onclick = function( e ) 
        {
          if( ( e.target.constructor === window.SVGSVGElement ) ||
               ( e.target.id === "holder" ) ) 
          {
            if( interval != null ) 
            {
              window.clearInterval( interval );
              interval = null;
            } 
            else 
            {
              interval = window.setInterval( runner, Math.floor( 1000 / frameRate ) );
            }
          }
        };

        interval = window.setInterval( runner, Math.floor( 1000 / frameRate ) );
    }

} ) ( DESANTI );
